package com.gem.demo.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AliPayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102600764188";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+owu5TrxpIEZIbRCpthzyZ9t7j92Yev5mfyhX7WNx/frL2CNkyQyGFa9WYCcWP9UmLoCgX4dfW2NYEViWaQ/PX3xCB/veSY1AHZ0JRNelRkWMuYSfW0CW594+jECGCCIXN5a3y6C0k7nIwYaArzTCDkJnd+hnWCi39dmtitpu7bOkex6+yhl07Khwq9x5YjKYWd23t9L7GADO6nLDbxywBWmT011B0uAxLCN+M3ZeWq8wMjrrG3X1w7D4B6RSNZcKBTz0vLVBXmcH+wDb+NGNxSczUE0IrDkLhll6VeQ9IRPJP8xIhSqba2lYo4+/1ymf76UsyhZHSzhZIkREpE3VAgMBAAECggEAbKguBH72MM0ughV4C+M6+IdtuC211jU0T2NmsUcjCVQD4K/e7JETTFGL0KWZYbscWFjlA4OvexBxvT6VyZU0Z7Q69L/sNTSjB8pZOXE9oHw/JAiRqOqwE9Mw/2GdXUfBdo4+n5+2h3YzzFNRwIMchQbvnl3f3xeGjePZIGsmOVbSny0PXn71k5AKCZOMe08M+eDgGjMTN3EskvGpZK0Y196oWQX2FDnc9MVqwyB4KCs5MfMOTRSDHbOaDLJItK5a07wHXfpyJQKY8GAIINK7TYth4QEPoshZJFn17INyibHcFVBqiUip4RcyXxA9qrVJHQRmzMqBaeG1f7lSKDx8wQKBgQDmmsA2fXG33x7T2h7Vt/avdfnFF0MYBnNM86t8YEYvbaAyP1po6EsKqm+v66WA8KUMICihjliEibag5gM8VxL00auzOKekGIBdSV9JFMFn6zHShpLCWb9T9VQjEyCo0odxmtrIwEGVsSnVLxVWCz6dI28dvvwRAMfIa9HWTOY8aQKBgQDToYUv3LHYJQAjAbn04Epomv7OYkm8g8CYeDomKqTPrHYS6diQmtRnwjv+167DhKGhKb/h+sDGq179Skfqb0rTOJAt2E5AIt9XLkUklv2KxqWXj5DsCwVSGuBTqei2z1r30AjEzHzaoQcRjKaayJLgG9wFwWEXkjw4sWIEHSvIjQKBgGW9TKQ9wBgxVjZ9ezErUqii0imEU9ObtO70amobR5vRL+Y7UTYLlmAERfZFbuVuRkMNRR/R33fKEkr2b+MFP5XHk4skqcGaFbgSkPl7MMEaYQbS3JjmY6U1DYPUAoq5J4yVl4UOXWEfoqcteKpXl65YXcOv6SHPSFVCTHfRwZpRAoGAfzDoNyfQyzMRrfhvprjWf6AH3Eo+PsqAiiJX8HBYtWfVXvCkc+RaHDIklLlUE7Y23gGVjV+DVOPSJzDpoABbXC72mFcUUH+k82Sfsan9n9Zb14c1dmf5Pqtgf2fysUxWQ/IIEx9DOrLk6Ks7xnMdswuLZPogPGZrQzd4zTgrBFECgYEAg+rzDMwNA3hw75ElhcdDgLTuixRlPR5cuB1k94n/M2wfHM97H1yQAdrMEvJjkXWWfybSqwGKb5H4gXJrKKa1wH3++ai/YoFjOhwgOXkuzGjTk1ugmbqC06ToKIiuEutfRuuQQ3ouAmo/1ScHuy0egdXlNI/ziD+ICFW0l8lWtNE=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvqMLuU68aSBGSG0QqbYc8mfbe4/dmHr+Zn8oV+1jcf36y9gjZMkMhhWvVmAnFj/VJi6AoF+HX1tjWBFYlmkPz198Qgf73kmNQB2dCUTXpUZFjLmEn1tAlufePoxAhggiFzeWt8ugtJO5yMGGgK80wg5CZ3foZ1got/XZrYrabu2zpHsevsoZdOyocKvceWIymFndt7fS+xgAzupyw28csAVpk9NdQdLgMSwjfjN2XlqvMDI66xt19cOw+AekUjWXCgU89Ly1QV5nB/sA2/jRjcUnM1BNCKw5C4ZZelXkPSETyT/MSIUqm2tpWKOPv9cpn++lLMoWR0s4WSJERKRN1QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost8088/ProductWeb/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost8088/ProductWeb/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

